package com.example.myapplication0302;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

public class MainActivity extends AppCompatActivity {
    Button setBut;

//    @Override
//    protected void onCreate(@Nullable Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_info);
//
//        Button button = (Button) findViewById(R.id.btn_denglu);
//        Button button1 = (Button) findViewById(R.id.btn_quxiao);
//
//        button.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                TextView text = (TextView)findViewById(R.id.name);
//                String strtext = text.getText().toString();
//                EditText num = (EditText)findViewById(R.id.password);
//                String str = num.getText().toString();
//                if (str.equals("123456")) {
//                    Toast.makeText(MainActivity.this, strtext+"登陆成功", Toast.LENGTH_SHORT).show();
//                    Intent intent =new Intent();
//                    intent.setClass(MainActivity.this,Setting.class);
//                    startActivity(intent);
//                }
//                else {
//                    Toast.makeText(MainActivity.this, "登陆失败，请重新输入密码", Toast.LENGTH_SHORT).show();
//                    num.setText(null);
//                }
//
//            }
//        });
//
//        button1.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                    TextView text = (TextView) findViewById(R.id.name);
//                    text.setText(null);//将用户名一栏清空
//                    EditText num = (EditText) findViewById(R.id.password);
//                    num.setText(null);//将密码栏清空
//            }
//        });
//
//    }

    private  View jumpBtn;
    private TextView jump2RecyclerView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        jumpBtn = findViewById(R.id.tv_jump);
        jumpBtn.setOnClickListener(v ->{
            Intent intent=new Intent(MainActivity.this,Setting.class);
            startActivity(intent);
        });

        jump2RecyclerView=findViewById(R.id.tv_jump_recycler);
        jump2RecyclerView.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view){
                startActivity(new Intent(MainActivity.this, RecyclerView.class));
            }
        });

    }

}